<template>
  <div>
    <div class="all-form">
      <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <div class="first">I am First Vue3.x</div>
        <el-form-item label="账号" prop="account">
          <el-input type="text" v-model="ruleForm.account"></el-input>
        </el-form-item>
        <el-form-item label="密码" prop="pass">
          <el-input type="password" v-model="ruleForm.pass" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="验证码" prop="code">
          <el-input v-model="ruleForm.code"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="loginButton">提交</el-button>
          <el-button @click="resetData">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script lang ='ts'>
import { ref, defineComponent, reactive } from 'vue'
import { useRouter } from 'vue-router'

export default defineComponent({
  name: 'Login',
  props: {},
  setup: () => {
    const count = ref(0)
    let ruleForm = reactive({
      account: 'admin',
      pass: '123456',
      code: ''
    })

    const router = useRouter()
    let loginButton = () => {
      router.push({
        path: '/management'
      })
    }
    return { count, ruleForm, loginButton }
  },
})
</script>

<style scoped lang="less">
.all-form {
  width: 100%;
  height: 100vh;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
}
.demo-ruleForm {
  width: 450px;
  padding-right: 40px;
  box-sizing: border-box;
  background-color: rgba(70, 177, 240, 0.5);
  border-radius: 8px;
  .first {
    font-size: 26px;
    width: 100%;
    margin: 40px auto;
    text-align: center;
  }
}
</style>